let background = null;
-function createGDMLoginDialog(parentActor) {
- // We do this this here instead of at the top to prevent GDM
- // related code from getting loaded in normal user sessions
- const LoginDialog = imports.gdm.loginDialog;
-
- let loginDialog = new LoginDialog.LoginDialog(parentActor);
- return [loginDialog, true];
-}
-
-function createSessionUnlockDialog(parentActor) {
- let dialog = new UnlockDialog.UnlockDialog(parentActor);
- return [dialog, false];
-}
-
function _sessionUpdated() {
- Meta.keybindings_set_custom_handler('panel-run-dialog', sessionMode.hasRunDialog ? openRunDialog : null);
+ if (sessionMode.isGreeter)
+ screenShield.showDialog();
}
function start() {
_ensureUnlockDialog: function() {
if (!this._dialog) {
- [this._dialog, this._keepDialog] = Main.sessionMode.createUnlockDialog(this._lockDialogGroup);
+ let constructor = Main.sessionMode.unlockDialog;
+ this._dialog = new constructor(this._lockDialogGroup);
+ this._keepDialog = Main.sessionMode.isGreeter;
if (!this._dialog) {
// This session mode has no locking capabilities
this.unlock();
this._dialog.connect('unlocked', Lang.bind(this, this._onUnlockSucceded));
}
- if (this._keepDialog) {
+ if (Main.sessionMode.isGreeter) {
// Notify the other components that even though we are showing the
// screenshield, we're not in a locked state
// (this happens for the gdm greeter)
if (this._hasLockScreen)
this._clearLockScreen();
- if (this._keepDialog) {
- // The dialog must be kept alive,
- // so immediately go back to it
- // This will also reset _isLocked
- this._ensureUnlockDialog();
- return;
+ if (this._dialog && !this._keepDialog) {
+ this._dialog.destroy();
+ this._dialog = null;
}
this._lightbox.hide();
hasWorkspaces: false,
hasWindows: false,
isLocked: false,
- createUnlockDialog: null,
+ isGreeter: false,
+ unlockDialog: null,
components: [],
panel: {
left: [],
'gdm': {
allowKeybindingsWhenModal: true,
- createUnlockDialog: Main.createGDMLoginDialog,
+ isGreeter: true,
+ unlockDialog: imports.gdm.loginDialog.LoginDialog,
panel: {
left: [],
center: ['dateMenu'],
'lock-screen': {
isLocked: true,
+ isGreeter: undefined,
+ unlockDialog: undefined,
components: ['networkAgent', 'polkitAgent', 'telepathyClient'],
- createUnlockDialog: Main.createSessionUnlockDialog,
panel: {
left: ['userMenu'],
center: [],
hasRunDialog: true,
hasWorkspaces: true,
hasWindows: true,
+ unlockDialog: imports.ui.unlockDialog.UnlockDialog,
+ isLocked: false,
components: ['networkAgent', 'polkitAgent', 'telepathyClient',
'keyring', 'recorder', 'autorunManager', 'automountManager'],
panel: {
let params = _modes[this.currentMode];
params = Params.parse(params, _modes[DEFAULT_MODE]);
- this._createUnlockDialog = params.createUnlockDialog;
- delete params.createUnlockDialog;
+ // A simplified version of Lang.copyProperties, handles
+ // undefined as a special case for "no change / inherit from previous mode"
+ for (let prop in params) {
+ if (params[prop] !== undefined)
+ this[prop] = params[prop];
+ }
- Lang.copyProperties(params, this);
this.emit('updated');
- },
-
- createUnlockDialog: function() {
- if (this._createUnlockDialog)
- return this._createUnlockDialog.apply(this, arguments);
- else
- return null;
- },
+ }
});
Signals.addSignalMethods(SessionMode.prototype);